import time


class DateUtil:
    """ 日期工具类 """

    @staticmethod
    def get_current_date_str():
        """ 获取当前日期字符串，格式：yyyy-mm-dd hh:mm:ss """
        time_stamp = time.time()
        local_time = time.localtime(time_stamp)
        str_time = time.strftime("%Y-%m-%d %H:%M:%S", local_time)
        return str_time

    @staticmethod
    def str2timestamp(s):
        """ 字符串转时间戳，字符串格式：yyyy-mm-dd hh:mm:ss """
        t = time.strptime(s, "%Y-%m-%d %H:%M:%S")
        return time.mktime(t)